<? 
	if(isset($_POST['btngo']))
	{
		require("required/dbconnect.php");
		$main_cat=$_POST['main_cat'];
		$pageno=$_POST['pageno'];
		header("Location:uploadfiles.php?page=$pageno");
	}
	
	$title="Content"; 
	$pageid="4";
	$accessid=",a10,";

	if(isset($_POST['btnsubmit']))
	{
		require("required/dbconnect.php");
		
		$content_chn=mysql_escape_string($_POST['content_chn']);
		$content_eng=mysql_escape_string($_POST['content_eng']);
		$url_chn=$_POST['url_chn'];
		$url_eng=$_POST['url_eng'];
		$create_date=$_POST['create_date'];
		$status=$_POST['status'];
		$insert=mysql_query("insert into os_news(content_chn,content_eng,url_chn,url_eng,create_date,status)value('$content_chn','$content_eng','$url_chn','$url_eng','$create_date','$status')")or die(mysql_error());
		header("Location:news.php");
	}

	require("required/dbconnect.php"); 
	require("required/function.php");
	
	
	
		
		
	

	
	$get_content=mysql_query("select * from os_announcement order by create_date desc ")or die(mysql_error());		
	
	
	require("required/header.php");
	checkAccess("allow_content_management",1);
?>
<script src="required/js/jquery-1.4.2.js"></script>
<script src="required/js/common_javascript.js"></script>
<?
if(!empty($_GET['action']))
	{
		
		switch($_GET['action'])
		{
			case 1:
				$msg="<div class='dw_success'>Data inserted</div>";
				
				break;
			case 2:
				$msg="<div class='dw_success'>Data Deleted</div>";
				
				break;
			case 3:
				$msg="<div class='dw_success'>Data Updated</div>";
				break;	
			default:
				$msg="Invalid";
				break;
		}
		
		echo "<script>displayMsg('divMsg')</script>";	
	}else{
		$msg="";
	}

?>
<table width="100%"  cellpadding="0" cellspacing="5" height="300">
<tr>
	

	<td valign="top">
			<div class="title">Announcements View All</div>
			
             <div id="divMsg"><?= $msg ?></div>
			<table width="100%" class="solidborder">
				<tr class="table_header">
					<td width="2%">No</td><td width="50%">Title</td><td>Date</td><Td>Content Type</Td><Td>Publish</Td><td width="20%">Action</td>
				</tr>
				<? if(mysql_num_rows($get_content)==0){ ?>
				<tr valign="top">
					<td align="center" colspan="7">
					- No record found - 
					</td>
				
				<? 
					}
					else
					{
						$no=1;
						while($a=mysql_fetch_array($get_content,MYSQL_ASSOC))
						{
							$id=$a['id'];
							 if($no%2==0)
							{
								$class1="table_item_even";
								$class2="table_item_odd";
							}
							else
							{
								$class1="table_item_odd";
								$class2="table_item_even";
							}
							
							$status=convertStatus($a['status']);
				?>
			 <tr height="20" valign="top" class="<?= $class1 ?>" onmouseover="this.className='table_item_mouseover'" onmouseout="this.className='<?= $class1 ?>'">
						<td align="center"><?= $no ?></td>
						<td><?= $a['title'] ?></td>
						<td><?= $a['create_date'] ?></td>
                        <Td><?= $a['content_type'] ?></Td>
                        <td><?= $a['status']=="1"?"Yes":"No" ?></td>
                        <td align="center">
                            <a href="announcement_viewfull.php?id=<?= $id ?>"><img src="images/icons/view_icon.gif" border="0"></a>  
                            <a href="announcement_edit.php?id=<?= $id ?>"><img src="images/icons/edit.gif" border="0"></a>  
                            <a href="announcement_delete.php?id=<?= $id ?>"><img src="images/icons/delete.gif" border="0"></a>
                        </td>								
			  </tr>
				<? 
					$no++; 
						}
					}
				?>
				
			</table>
            <br />
			<input type="button" value="Add" class="button" onclick="window.open('announcement_add.php','_self')" />
		</td>
	</tr>
	
	
</table>
<? require("required/footer.php"); ?>

